package com.ktjiaoyu.travelaiagent.config;

import com.ktjiaoyu.travelaiagent.tools.*;
import jakarta.annotation.Resource;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbacks;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Tools4AIConfig {
    // 统一使用IoC注入工具
    @Resource
    private TextFileTool textFileTool;
    @Resource
    private WebSearchTool webSearchTool;
    @Resource
    private WebScrapingTool webScrapingTool;
    @Resource
    private TerminalExecuteTool terminalExecuteTool;
    @Resource
    private DownloadTool downloadTool;
    @Resource
    private PdfGenerateTool pdfGenerateTool;
    @Resource
    private TerminateTool terminateTool;

    @Bean
    public ToolCallback[] aiTools(){
        // 将自定义的工具对象注册ToolCallback数组
        return ToolCallbacks.from(
                textFileTool,
                webSearchTool,
                webScrapingTool,
                terminalExecuteTool,
                downloadTool,
                pdfGenerateTool,
                terminateTool // 注册终止工具
        );
    }
}
